import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useTestStore = defineStore('test', () => {
  // 创建状态
  const n = ref(0);
  // 创建计算属性
  const doubleN = computed(()=>{
    return n.value * 2;
  })
  // 创建状态的专属修改方法
  function changeN(){
    n.value++
  }

  return { n, changeN, doubleN };
})
